<div style="font-weight:bold;font-size:20px;margin-top: 20px;">${serialNumber}、城市人口迁徙</div>
<div id="table16-desc" style="text-indent: 2em;font-size:20px;margin-top: 20px;line-height: 35px;">
</div>
<table  id='table16' style="margin-top:20px;">
    <tr>
        <th>目前居住地市</th>
        <th>上月居住地市</th>
        <th>人数</th>
    </tr>
</table>
<div style="margin-top: 10px; text-align: center; font-size: 20px;">表16 城市人口迁入情况</div>
<table  id='table17' style="margin-top:20px;">
    <tr>
        <th>上月居住地市</th>
        <th>目前居住地市</th>
        <th>人数</th>
    </tr>
</table>
<div style="margin-top: 10px; text-align: center; font-size: 20px;">表17 城市人口迁出情况</div>
<script>
    (function () {

        var dataTable16 = ${dataTable16}
        var dataTable17 = ${dataTable17}
        var dataTable16Merged = ${dataTable16Merged}
        var dataTable17Merged = ${dataTable17Merged}

        $("#table16-desc").text("据统计，由表16可看出"+dataTable16Merged[0].preCounty+"市是全省迁入规模最大的城市，迁入总人数为"+dataTable16Merged[0].count+"人，占比${dataTable16FirstRate}%，其次是"+dataTable16Merged[1].preCounty+"是，迁入总人数为"+dataTable16Merged[1].count+"人，占比${dataTable16SecondRate}%，"+dataTable16Merged[2].preCounty+"是迁入总人数为"+dataTable16Merged[2].count+"人，占比${dataTable16ThirdRate}%，排名第三。由表17可看出"+dataTable17Merged[0].preCounty+"市是全省迁出规模最大的城市，迁出总人数为"+dataTable17Merged[1].count+"人，占比${dataTable17FirstRate}%，其次是"+dataTable17Merged[1].preCounty+"是，迁出总人数为"+dataTable17Merged[1].count+"人，占比${dataTable17SecondRate}%，"+dataTable17Merged[2].preCounty+"是迁出总人数为"+dataTable17Merged[1].count+"人，占比${dataTable17ThirdRate}%，排名第三。")

        $(document).ready(function(){
            $.each(dataTable16,function(index,item){
                var county = '<td>'+item.county+'</td>';
                if (item.county==='总计') {
                    county = '<td style="font-weight: bold">'+item.county+'</td>';
                }
                var tr='<td>'+item.preCounty+'</td>'+county+'<td>'+item.count+'</td>';
                $("#table16").append('<tr>'+tr+'</tr>')
            });
            $.each(dataTable17,function(index,item){
                var county = '<td>'+item.county+'</td>';
                if (item.county==='总计') {
                    county = '<td style="font-weight: bold">'+item.county+'</td>';
                }
                var tr='<td>'+item.preCounty+'</td>'+county+'<td>'+item.count+'</td>';
                $("#table17").append('<tr>'+tr+'</tr>')
            });
            merge("#table16 tr");
            merge("#table17 tr");
            function merge(id) {
                var $st = -1;
                $(id).each(function(r) {
                    if($st === -1) {
                        $st = $(this).find('td:eq(0)');
                    }else if($st.html() === $(this).find('td:eq(0)').html()) {
                        $st.prop('rowspan', $st.prop('rowspan')+1);
                        $(this).find('td:eq(0)').remove();
                    }else $st = $(this).find('td:eq(0)');
                });
            }
        });
    })()
</script>